package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.ArticleCommentClientService;

import javax.annotation.Resource;

/**
 * 普通子评论
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/article/comment/client")
public class ArticleCommentClientController {

	@Autowired
	private ArticleCommentClientService articleCommentClientService;

	/**
	 * 子评论
	 * 
	 * @param content
	 *            评论内容
	 * @param fromUserId
	 *            评论者
	 * @param toUserId
	 *            被评论者
	 * @param articleCommentId
	 *            评论ID
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/create", method = { RequestMethod.POST })
	public Map<String, Object> create(@RequestParam(required = true) String content,
			@RequestParam(required = true) String fromUserId, @RequestParam(required = true) String toUserId,
			@RequestParam(required = true) String articleCommentId) {
		return articleCommentClientService.create(content, fromUserId, toUserId, articleCommentId);
	}

	@ResponseBody
	@RequestMapping(value = "/delete/by/id", method = { RequestMethod.POST })
	public Map<String, Object> deleteById(@RequestParam(required = true) String id) {
		return articleCommentClientService.deleteById(id);
	}

	@ResponseBody
	@RequestMapping(value = "/update", method = { RequestMethod.POST })
	public Map<String, Object> update(@RequestParam(required = true) String id,
			@RequestParam(required = false) String content, @RequestParam(required = false) String fromUserId,
			@RequestParam(required = false) String toUserId, @RequestParam(required = false) String articleCommentId) {
		return articleCommentClientService.update(id, content, fromUserId, toUserId, articleCommentId);
	}

}
